print: Improve sheet drawing a bit
authorBenjamin Otte <otte@redhat.com>
Fri, 3 Oct 2014 03:46:49 +0000 (05:46 +0200)
committerBenjamin Otte <otte@redhat.com>
Fri, 3 Oct 2014 04:18:06 +0000 (06:18 +0200)
This is only one step in the right direction. Long term this code should
probably be replaced by real widgets.

gtk/gtkprintunixdialog.c

index 3e999026bc24041a995064327dcba008e7314f66..7d1ff6e636b4abdcd56e8c80eb39a49db417b772 100644 (file)
@@ -2203,32 +2203,23 @@ paint_page (GtkWidget *widget,
 {
   GtkStyleContext *context;
   gint x, y, width, height;
-  gint text_y, linewidth;
-  GdkRGBA color;
+  gint text_y;
 
   x = x_offset * scale;
   y = y_offset * scale;
   width = 20 * scale;
   height = 26 * scale;
 
-  linewidth = 2;
   text_y = 21;
 
   context = gtk_widget_get_style_context (widget);
 
   gtk_style_context_save (context);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);
   gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
 
-  gtk_style_context_get_background_color (context, 0, &color);
-  gdk_cairo_set_source_rgba (cr, &color);
-  cairo_rectangle (cr, x, y, width, height);
-  cairo_fill (cr);
-
-  gtk_style_context_get_color (context, 0, &color);
-  gdk_cairo_set_source_rgba (cr, &color);
-  cairo_set_line_width (cr, linewidth);
-  cairo_rectangle (cr, x + linewidth/2.0, y + linewidth/2.0, width - linewidth, height - linewidth);
-  cairo_stroke (cr);
+  gtk_render_background (context, cr, x, y, width, height);
+  gtk_render_frame (context, cr, x, y, width, height);
 
   cairo_select_font_face (cr, "Sans",
                           CAIRO_FONT_SLANT_NORMAL,
@@ -2762,13 +2753,10 @@ draw_page_cb (GtkWidget          *widget,
   cairo_rectangle (cr, shadow_offset + 1, shadow_offset + 1, w, h);
   cairo_fill (cr);
 
-  gtk_style_context_get_background_color (context, state, &color);
-  gdk_cairo_set_source_rgba (cr, &color);
-  cairo_rectangle (cr, 1, 1, w, h);
-  cairo_fill (cr);
+  gtk_render_background (context, cr, 1, 1, w, h);
+
   cairo_set_line_width (cr, 1.0);
   cairo_rectangle (cr, 0.5, 0.5, w + 1, h + 1);
-
   gtk_style_context_get_color (context, state, &color);
   gdk_cairo_set_source_rgba (cr, &color);
   cairo_stroke (cr);